<template>
  <view class="my-search-container"  @click="searchClick" :style="{backgroundColor: bgColor}">
    <!-- 搜索输入框 -->
    <view class="my-search-box" :style="{borderRadius: radius + 'px'}">
      <uni-icons type="search" size="18"></uni-icons>
      <text class="my-search-text">搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        // 可用视口高度
        wh: 0
      };
    },
    props:{
      bgColor:{
        type: String,
        default: '#c00000'
      },
      radius:{
        type: Number,
        default:36
      }
    },
    onLoad() {
        const sysInfo = uni.getSystemInfoSync()
        
        // 可用高度 = 屏幕高度 - navigationBar高度 - tabBar高度 - 自定义的search组件高度
        this.wh = sysInfo.windowHeight - 50
    },
    methods:{
      searchClick() {
        console.log('3333')
        this.$emit("click1")
      }
    }
  }
</script>

<style lang="scss">
.my-search-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50px;
  // background-color: #c00000;
  padding: 0 10px;
  .my-search-box {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 36px;
    width: 100%;
    // border-radius: 18px;
    background-color: #ffffff;
    .my-search-text {
      margin-left: 6px;
    }
  }
}
</style>
